using System;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class ChatPanel : Panel
	{
		protected override Size MeasureOverride(Size availableSize)
		{
			Size result = base.MeasureOverride(availableSize);
			if (base.get_Children().get_Count() != 2)
			{
				return result;
			}
			if (!double.IsInfinity(availableSize.get_Width()) && !double.IsInfinity(availableSize.get_Height()))
			{
				base.get_Children().get_Item(1).Measure(availableSize);
				double num = availableSize.get_Height() - base.get_Children().get_Item(1).get_DesiredSize().get_Height();
				if (num <= 0.0)
				{
					num = 0.0;
				}
				base.get_Children().get_Item(0).Measure(new Size(availableSize.get_Width(), num));
				return availableSize;
			}
			return result;
		}
		protected override Size ArrangeOverride(Size finalSize)
		{
			Size result = base.ArrangeOverride(finalSize);
			if (base.get_Children().get_Count() != 3)
			{
				return result;
			}
			double arg_32_0 = base.get_Children().get_Item(0).get_DesiredSize().get_Width();
			double num = finalSize.get_Height() - base.get_Children().get_Item(1).get_DesiredSize().get_Height();
			if (num <= 0.0)
			{
				num = 0.0;
			}
			double num2 = num;
			base.get_Children().get_Item(0).Arrange(new Rect(0.0, 0.0, finalSize.get_Width(), num));
			double arg_B7_0 = base.get_Children().get_Item(1).get_DesiredSize().get_Width();
			num = base.get_Children().get_Item(1).get_DesiredSize().get_Height();
			base.get_Children().get_Item(1).Arrange(new Rect(0.0, num2, finalSize.get_Width(), num));
			finalSize.set_Height(num2 + num);
			double arg_11F_0 = base.get_Children().get_Item(2).get_DesiredSize().get_Width();
			num = base.get_Children().get_Item(2).get_DesiredSize().get_Height();
			num2 -= num;
			if (num2 < 0.0)
			{
				num2 = 0.0;
			}
			base.get_Children().get_Item(2).Arrange(new Rect(0.0, num2, finalSize.get_Width(), num));
			return finalSize;
		}
	}
}
